<?php /*a:3:{s:61:"D:\projects\original_admin\app\merchant\view\index\index.html";i:1755012743;s:61:"D:\projects\original_admin\app\merchant\view\common\base.html";i:1752764603;s:63:"D:\projects\original_admin\app\merchant\view\common\header.html";i:1754830154;}*/ ?>
<!DOCTYPE html>
<html lang="zh-CN">

<head>
	<meta charset="UTF-8" />
	<meta name="renderer" content="webkit" />
	<meta name="force-rendering" content="webkit" />
	<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>管理系统</title>
	<script src="/static/merchant/js/jquery-min.js"></script>
	<link rel="stylesheet" href="/static/merchant/layui/css/layui.css">
	<script type="text/javascript" src="/static/merchant/layui/layui.js"></script>
	<link rel="stylesheet/less" type="text/css" href="/static/merchant/css/index.less" />
	<script src="/static/merchant/js/less.js"></script>
    
</head>
<body>
	<main class="CenterMain">
		<header class="Header">
    <div class="logo img_box">
        <img src="/static/merchant/images/logow.png">

    </div>
    <div class="top">
        <ul class="nav-buttons">
            <li id="toggle-btn">

                <span class="desktop-text layui-icon layui-icon-spread-left">
                </span>
                <span class="mobile-text">菜单</span>
            </li>
        </ul>
        <dl class="menu-btn">
            <a class="img_box ">
                <img src="/static/merchant/images/head1.png">
                <i class="msg"></i>
            </a>
            <a class="img_box">
                <img src="/static/merchant/images/head2.png">
            </a>
        </dl>
        <span class="hr"></span>
        <ul class="layui-nav">

            <li class="layui-nav-item" lay-unselect>
                <a href="javascript:;">
                    <img  src="<?php echo htmlentities((string) (isset($userInfo['shop_thumb']) && ($userInfo['shop_thumb'] !== '')?$userInfo['shop_thumb']:'/static/merchant/images/sign-user.png')); ?>" class="layui-nav-img">
                    <span><?php echo htmlentities((string) $userInfo['shop_name']); ?></span>
                </a>
                <dl class="layui-nav-child">
                    <!-- <dd><a href="account_info.html">个人信息</a></dd> -->
                    <dd><a href="/merchant/account_pwd.html">密码修改</a></dd>
                    <dd style="text-align: center;"><a href="/merchant/login_out">退出</a></dd>
                </dl>
            </li>
        </ul>
    </div>

</header>
<div class="Sidebar" id="sidebar">
    <ul class="menu">
        <li class="menu-item">
            <div lay-on="url" href="/" class="title">
                <div class="img img_box">
                    <img class="img1" src="/static/merchant/images/nav22.png">
                    <img class="img2" src="/static/merchant/images/nav21.png">
                </div>
                <span>商品管理</span>
                <!-- <i class="layui-icon layui-icon-right"></i> -->
            </div>
        </li>
        <li class="menu-item <?php if($routers == 'order/list' || $routers == 'order/shop_back' || $routers == 'order/review'): ?>  active <?php endif; ?>">
            <div class="title">
                <div class="img img_box">
                    <img class="img1" src="/static/merchant/images/nav32.png">
                    <img class="img2" src="/static/merchant/images/nav31.png">
                </div>
                <span>订单管理</span>
                <i class="layui-icon layui-icon-right"></i>
            </div>
            <dl    <?php if($routers == 'order/list' || $routers == 'order/shop_back' || $routers == 'order/review'): ?>  style="display: block;" <?php else: ?> style="display:none;" <?php endif; ?> >
                <dd>
                    <a href="/merchant/order.html"  <?php if($routers == 'order/list'): ?>  class="active" <?php endif; ?> >订单管理</a>
                </dd>
                <dd>
                    <a href="/merchant/shop_back.html" <?php if($routers == 'order/shop_back'): ?>  class="active" <?php endif; ?>>退货管理</a>
                </dd>
                <dd>
                    <a href="/merchant/review.html" <?php if($routers == 'order/review'): ?>  class="active" <?php endif; ?>>订单评价</a>
                </dd>

            </dl>

        </li>
        <li class="menu-item <?php if($routers == 'finance/finance_cash' || $routers == 'finance/finance_account' || $routers == 'finance/finance_log' || $routers == 'finance/finance_logs'): ?>  active <?php endif; ?>">
            <div class="title">
                <div class="img img_box">
                    <img class="img1" src="/static/merchant/images/nav42.png">
                    <img class="img2" src="/static/merchant/images/nav41.png">
                </div>
                <span>财务提现</span>
                <i class="layui-icon layui-icon-right"></i>
            </div>

            <dl  <?php if($routers == 'finance/finance_cash' || $routers == 'finance/finance_account' || $routers == 'finance/finance_log' || $routers == 'finance/finance_logs'): ?>  style="display: block;" <?php else: ?> style="display:none;" <?php endif; ?>>
                <dd>
                    <a  <?php if($routers == 'finance/finance_cash'): ?>  class="active" <?php endif; ?> href="/merchant/finance_cash.html">提现</a>
                </dd>
                <dd>
                    <a  <?php if($routers == 'finance/finance_logs'): ?>  class="active" <?php endif; ?> href="/merchant/finance_logs.html">记录</a>
                </dd>
            </dl>

        </li>
        <!-- <li class="menu-item ">
            <div class="title">
                <div class="img img_box">
                    <img class="img1" src="images/nav52.png">
                    <img class="img2" src="images/nav51.png">
                </div>
                <span>消息中心</span>
                <i class="layui-icon layui-icon-right"></i>
            </div>

        </li> -->
        <li class="menu-item <?php if($routers == 'store/store_info' || $routers == 'store/store_notice' || $routers == 'store/store_model'): ?>  active <?php endif; ?>">
            <div class="title">
                <div class="img img_box">
                    <img class="img1" src="/static/merchant/images/nav62.png">
                    <img class="img2" src="/static/merchant/images/nav61.png">
                </div>
                <span>店铺设置</span>
                <i class="layui-icon layui-icon-right"></i>
            </div>

            <dl <?php if($routers == 'store/store_info' || $routers == 'store/store_notice' || $routers == 'store/store_model'): ?>  style="display: block;" <?php else: ?> style="display:none;" <?php endif; ?>>
                <dd>
                    <a  <?php if($routers == 'store/store_info'): ?>  class="active" <?php endif; ?> href="/merchant/store_info.html">店铺信息 </a>
                </dd>
                <dd>
                    <a <?php if($routers == 'store/store_notice'): ?>  class="active" <?php endif; ?> href="/merchant/store_notice.html">店铺公告</a>
                </dd>
                <dd>
                    <a <?php if($routers == 'store/store_model'): ?>  class="active" <?php endif; ?>  href="/merchant/store_model.html">运费模板</a>
                </dd>
            </dl>

        </li>
    </ul>
</div>
		 
<div class="Content" id="content">
    <div class="container">
        <!-- 搜索栏 -->
        <form class="layui-form search-form SearchCom" lay-filter="searchForm">
            <div class="layui-form-item">
                <div class="input-inline">
                    <select name="category" lay-search lay-filter="category">
                        <option value="">商品分类</option>
                        <option value="1">定制实物</option>
                        <option value="2">设计原创</option>
                    </select>
                </div>

                <div class="layui-input-wrap">
                    <div class="layui-input-prefix">
                        <i class="layui-icon layui-icon-search"></i>
                    </div>
                    <input type="text" name="keyword" placeholder="请输入搜索内容" class="layui-input">
                </div>
                <button class="layui-btn layui-btn-blue" style="margin-right: 20px;" lay-submit
                    lay-filter="search">查询</button>
                <div class="input-inline">
                    <select name="isShelved" lay-filter="isShelved">
                        <option value="">是否上架</option>
                        <option value="1">是</option>
                        <option value="0">否</option>
                    </select>
                </div>
                <div class="input-inline">
                    <input type="text" name="publishTime" placeholder="发布时间" class="layui-input"
                        id="publishTime">
                </div>
                <div class="foot">
                    <a href="shop_add.html" class="layui-btn layui-btn-normal"><i
                            class="layui-icon layui-icon-add-circle"></i>添加商品</a>

                </div>
            </div>
        </form>

        <!-- 商品表格 -->
        <table class="layui-hide" id="productTable" lay-filter="productTable" lay-skin="line"></table>

    </div>
    <script type="text/html" id="toolbarTpl">
        <div class="layui-btn-group">
            <button class="layui-btn layui-btn-normal" lay-event="batchDelete">批量删除</button>
        </div>
    </script>
    <script type="text/html" id="statusTpl">
        {{#  if(d.status === 0){ }}
        <span class="layui-badge layui-bg-orange">待审核</span>
        {{#  } else if(d.status === 1){ }}
        <span class="layui-badge layui-bg-green">审核通过</span>
        {{#  } else if(d.status === 2){ }}
        <span class="layui-badge layui-bg-red">审核未通过</span>
        {{#  }}}
        <p style="font-size: 12px;padding:5px;color:red">{{d.fail_msg}}</p>
    </script>

    <script type="text/html" id="operateTpl">
        <div class="foot">
        <a class="btn-edit" lay-event="edit">编辑</a>
        <span>|</span>
        <a class="btn-delete" lay-event="delete">删除</a>
        {{# 
                if(d.status === '未通过'){ 
                
                }}
                <span>|</span>
        <a class="btn-edit" lay-event="review">审核</a>
        {{#   } }}
    </div>
    </script>
</div>

	</main>
</body>
<script  src="/static/merchant/js/index.js"></script>
<script src="/static/merchant/js/base.js"></script>
 
    <script>
            changeTitleName('商品管理')
            layui.use(['table', 'form', 'laydate'], function () {
            var table = layui.table;
            var form = layui.form;
            var laydate = layui.laydate;

            // 渲染日期选择器
            laydate.render({
                elem: '#publishTime',
                range: true // 开启日期范围选择
            });
            table.render({
                elem: '#productTable',
                url: '/merchant/merchant-goods-list', // 使用本地数据
                height: 'full-100', // 关键参数：表格高度为页面高度减去100px

                page: {
                    limit: 10, // 每页17条 → 200/17 ≈ 12页（17*11=187，第12页13条）
                    limits: [10, 17, 20, 30], // 包含17，默认选中17
                    groups: 5, // 页码连续显示5个

                    prev: '<',
                    next: '>',
                    layout: ['count', 'prev', 'page', 'next', 'limit', 'skip'], // 显示总条数和跳转
                    theme: '#1E9FFF',// 分页主题色
                    jump: function (obj, first) {
                        console.log(obj.curr); // 得到当前页，以便向服务端请求对应页的数据。
                        console.log(obj.limit); // 得到每页显示的条数

                        // 首次不执行
                        if (!first) {
                            // do something
                        }
                    }
                },
                limit: 15,
                limits: [10, 15, 20, 30],
                cols: [
                    [
                   
                    {
                        field: 'name',
                        title: '商品信息',
                        minWidth: 200,
                        //width: 300,
                        maxWidth: 300,
                        templet: function (d) {
                            return `
                            <div class="shopName">
                            <div class="img img_100">
                             <img src="`+ d.image + `"></div>
                             <div class="info">
                                <p>`+ d.store_name + `</p>
                                 <p>`+ d.bar_code + `</p>
                             </div>
                               </div>
                             `;
                        }
                    },
                    {
                        field: 'cate_name',
                        title: '分类',
                    },
                    {
                        field: 'category',
                        title: '商品类型',
                        templet:function(d){
                            return d.goods_type === 1 ? '实物' : '数字珍品';
                        }
                    },
                    
                    {
                        field: 'price',
                        title: '价格',
                        templet: function (d) {
                            return '¥' + d.ot_price;
                        }
                    },
                    {
                        field: 'price',
                        title: '折扣价',
                        templet: function (d) {
                            return '¥' + d.price;
                        }
                    },
                    {
                        field: 'stock',
                        title: '库存',
                    },
                    {
                        field: 'sales',
                        title: '销量',
                    },
                    {
                        field: 'create_time',
                        title: '发布时间',
                    },
                    {
                        field: 'status',
                        title: '状态',
       
                        templet: '#statusTpl'
                    },
                    {
                        field: 'is_show',
                        title: '是否上架',
                        width: 110,
                        templet: function (d) {
                            return d.is_show ?
                                '<input type="checkbox" name="isShelved" value="' + d.id +
                                '" lay-skin="switch" lay-text="" checked>' :
                                '<input type="checkbox" name="isShelved" value="' + d.id +
                                '" lay-skin="switch" lay-text="">';
                        }
                    },
                  
                    {
                        //  fixed: 'right',
                        title: '操作',
                        width: 160,
                        toolbar: '#operateTpl'
                    }
                    ]
                ],
                done: function (res, curr, count) {
                    console.log('表格渲染完成');
                }
            });

            // 监听表格复选框选择
            table.on('checkbox(productTable)', function (obj) {
                console.log(obj);
            });


            // 监听行工具事件
            table.on('tool(productTable)', function (obj) {
                var data = obj.data;
                switch (obj.event) {
                    case 'edit':

                        window.location.href = '/merchant/shop_edit.html?id=' + data.id
                        break;
                    case 'delete':

                        layer.alert('确认删除此商品', {
                            title: '提示',
                            btn: ['确定', '取消'],
                            btn1: function () {
                                layer.msg('删除成功', {
                                    icon: 1
                                });
                            },
                            btn2: function () {
                            },
                            area: ['600px', '260px'],
                            skin: 'xieyiDialog'
                        });
                        break;
                    case 'review':

                        layer.alert('商品已提交到商城管理员审核，请耐心等待，谢谢', {
                            title: '提示',
                            btn: ['确定', '取消'],
                            btn1: function () {
                            },
                            btn2: function () {
                            },
                            area: ['600px', '260px'],
                            skin: 'xieyiDialog'
                        });
                        break;
                }
            });

            // 监听搜索表单提交
            form.on('submit(search)', function (data) {
                table.reload('productTable', {
                    where: data.field,
                    page: {
                        curr: 1 // 重新从第 1 页开始
                    }
                });
                return false;
            });

            // 监听添加商品按钮
            form.on('submit(addProduct)', function () {
                //layer.open({
                // type: 2,
                // title: '添加商品',
                //   content: 'shop_add.html',
                //   area: ['800px', '600px']
                //  });
                //  return false;
            });

            // 监听开关状态变化
            form.on('switch(isShelved)', function (obj) {
                var id = this.value;
                var isShelved = obj.elem.checked ? 1 : 0;
                console.log('商品ID: ' + id + ', 是否上架: ' + isShelved);

                // 模拟更新操作
                layer.msg(isShelved ? '上架成功' : '下架成功', {
                    icon: 1
                });
            });

            // 监听窗口大小变化，动态调整表格高度
            window.onresize = function () {
                table.resize('productTable');
            };
        });
    </script>
>
</html>